
import {BrowserRouter,Route,Redirect} from 'react-router-dom'
import {Suspense,lazy} from 'react'
import AuthRoute from './components/authRoute/authRoute.jsx'
let Home=lazy(()=>import('./views/home/home.jsx'))
let City =lazy(()=>import('./views/city/city.jsx'))
let Map=lazy(()=>import('./views/map/map.jsx'))
let Login=lazy(()=>import('./views/login/login.jsx'))
let Registe=lazy(()=>import('./views/registe/registe.jsx'))
let Rent=lazy(()=>import('./views/rent/rent.jsx'))
let RentAdd=lazy(()=>import('./views/rentAdd/add.jsx'))
function App() {
  return (
    <BrowserRouter>
      <Suspense fallback={<div className='loading'>loading...</div>}>
        <div className="App">
        <Route path="/" exact render={() => <Redirect to="/home" />} />
          <Route path='/home' component={Home}></Route>
          <Route path='/city' component={City}></Route>
          <Route path='/map' component={Map}></Route>
          <Route path='/login' component={Login}></Route>
          <Route path='/registe' component={Registe}></Route>
          <AuthRoute path='/rent' Component={Rent} exact></AuthRoute>
          <AuthRoute path='/rent/add' Component={RentAdd} ></AuthRoute>
        </div>
        </Suspense>
    </BrowserRouter>
  );
}

export default App;
